package com.designType.stateType;

//待支付状态
public class UnpaidState implements OrderState {
    @Override
    public void pay(OrderContext context) {
        System.out.println("支付成功");
        context.setState(new PaidState());
    }

    @Override
    public void cancel(OrderContext context) {
        System.out.println("订单已取消");
//        context.setState(new CancelledState());
    }

    // 其他操作不支持
    @Override
    public void ship(OrderContext context) {
        throw new UnsupportedOperationException("待支付状态不能发货");
    }

    @Override
    public void receive(OrderContext context) {
        throw new UnsupportedOperationException("非法操作");
    }

}
